package com.sec.android.app.myfiles.module.abstraction;

import com.sec.android.app.myfiles.util.chain.Chain;

public abstract class AbsModuleManager implements Chain<AbsModuleManager> {

    private AbsModuleManager mNext = null;

    @Override
    public void setNext(AbsModuleManager next) {
        mNext = next;
    }

    public int getModuleList(int modules) {
        int moduleList = modules;

        if (isSupportMode()) {
//            Log.e(this, "Modules are changed");
            moduleList &= _getModuleList();
        }

        if (mNext != null)
            moduleList = mNext.getModuleList(moduleList);

        return moduleList;
    }

    protected abstract int _getModuleList();

    protected abstract boolean isSupportMode();
}
